import Http from "../../utils/HttpUtil";
import URL from "../URL";
export default{
    Video:0, //视频 
    Material:1, //1课件
    
    //查询栏目列表
    async  PaiStudyColumnSelectColumnList(){
        let url=URL.GetURL(URL.PaiStudyColumnSelectColumnList);
        return await(Http.Get(url))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //查询课程列表
    async  PaiStudyColumnSelectCurriculumList(columnId,   page,  type ){
        let url=URL.GetURL(URL.PaiStudyColumnSelectCurriculumList)+`?columnId=${columnId}&page=${page}&type=${type}`;
        return await(Http.Get(url))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //查询课程节列表
    async  PaiStudyColumnSelectCurriculumSection(curriculumId){
        let url=URL.GetURL(URL.PaiStudyColumnSelectCurriculumSection)+`?curriculumId=${curriculumId}`;
        return await(Http.Get(url))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //节详情
    async  PaiStudyColumnSelectSectionDetails(sectionId,  type, curriculumId){
        let url=URL.GetURL(URL.PaiStudyColumnSelectSectionDetails)+
        `?sectionId=${sectionId}&type=${type}&curriculumId=${curriculumId}`;
        return await(Http.Get(url))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //查看课程解锁
    async  PaiStudyColumnSelectCurriclumUnlock(userId,   columnId ){
        let url=URL.GetURL(URL.PaiStudyColumnSelectCurriclumUnlock)+`?userId=${userId}&columnId=${columnId}`;
        return await(Http.Get(url))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //课程购买
    //type 0视频 1课件
    async  PaiStudyColumnCurriculumBuy(userId ,payPassword ,type , columnId){
        var para={userId ,payPassword ,type , columnId};
        let url=URL.GetURL(URL.PaiStudyColumnCurriculumBuy);
        return await(Http.Post(url,para))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },
}